import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/views/layout/Layout.vue'
Vue.use(Router)
export const asyncRouterMap = [
  {
    path: '/',
    component: Layout,
    redirect: '/login', // 默认子路由
    name: 'mainIndex',
    children: [
      {
        path: '/index',
        component: () => import('@/views/dashboard/index.vue')
      },
      {
        path: '/course/coursetype',
        component: () => import('@/views/coursetype/index.vue')
      },
      {
        path: '/course/publish',
        component: () => import('@/views/course/index.vue')
      },
      {
        path: '/course/modify',
        component: () => import('@/views/course/modify.vue')
      },
      {
        path: '/course/sort',
        component: () => import('@/views/course/sort.vue')
      },
      {
        path: '/course/list',
        component: () => import('./views/course/list.vue')
      },
      {
        path: '/photo/list',
        component: () => import('./views/photo/photo.vue')
      },
      {
        path: '/code/list',
        component: () => import('./views/code/index.vue')
      },
      {
        path: '/code/modify',
        component: () => import('./views/code/modify.vue')
      },
      {
        path: '/questions/list/choice',
        component: () => import('./views/questions/choice.vue')
      },
      {
        path: '/questions/list/essay',
        component: () => import('./views/questions/essay.vue')
      },
      {
        path: '/questions/list/category',
        component: () => import('./views/questions/category.vue')
      },
      {
        path: '/language',
        component: () => import('./views/language/index.vue')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index.vue')
  },
  {
    path: '*',
    component: () => import('@/views/404.vue')
  }
]
var myRouter = new Router({
  routes: asyncRouterMap
})
export default myRouter
